<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/v2/console/common/taglibs.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
	<link rel="stylesheet" href="${path}/v2/console/css/base.css">
	<link rel="stylesheet" href="${path}/v2/console/css/style.css">
	<script src="${path}/v2/console/js/jquery-1.9.1.min.js"></script>
	<script src="${path}/v2/console/js/globle.js"></script>
	<script src="${path}/v2/console/My97DatePicker/WdatePicker.js"></script>
	<script>
	</script>
</head>
<body>
<div id="wrapper">
	<div class="main">
		<div class="main-right">
			<div class="column-name">
				<h2>
					内容管理 > <b>评论列表</b>
				</h2>
			</div>
			<form id="pageForm" name="form"
				action="${pageContext.request.contextPath}/siteArticleComment/siteArticleCommentList.html"
				method="post">
				<input type="hidden" name="articleId" value="${articleId }">
				<div class="check">
						<div class="check-item date">
							<span class="check-tit">时间：</span>
							<input type="text" value="${beginDate}" class="input" name="beginDate" id="begindate" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'enddate\')||\'%y-%M-%d\'}'})" readonly="readonly"/>
							<span class="check-tit">至</span>
							<input type="text" value="${endDate}" class="input" name="endDate" id="enddate" onClick="WdatePicker({minDate:'#F{$dp.$D(\'begindate\')}',maxDate:'%y-%M-%d'})" readonly="readonly"/>
						</div>
						<div class="check-item">
							<span class="check-tit">状态:</span>
							<select class="input" name="isPass" >
								<option value="0" <c:if test="${isPass ==0}">selected="selected"</c:if> >待审</option>
								<option value="1" <c:if test="${isPass ==1}">selected="selected"</c:if> >通过</option>
								<option value="" <c:if test="${empty isPass}">selected="selected"</c:if>>全部</option>
							</select>
						</div>
						<div class="check-btn">
							<input type="submit" class="btn w96" value="查  询">
						</div>
				</div>
				<div class="content">
					<table class="table" width="100%" border="0" cellspacing="0"
						cellpadding="0">
						<thead>
							<tr>
								<th>内容</th>
								<th>状态</th>
								<th>时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${page.datasource}" var="data">
							<tr>
								<td>${data.content}</td>
								<td>
									<c:if test="${data.isPass ==1 }">通过</c:if>
									<c:if test="${data.isPass ==0 }">待审</c:if>
								</td>
								<td><fmt:formatDate value="${data.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td>
									<c:if test="${data.isPass ==1 }">
										<a href="javascript:void(0)" id="${data.cid}" name="cannelbtn">取消</a>
									</c:if>
									<c:if test="${data.isPass ==0 }">
										<a href="javascript:void(0)" id="${data.cid}" name="passbtn">通过</a>
									</c:if>
									<a href="javascript:void(0);" id="${data.cid}" class="remove">删除</a>
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
					<div id="page">
						<%@ include file="/v2/console/common/pageView.jsp"%>
					</div>
				</div>
			</form>
		</div>

		<div class="popBox remove-pop">
			<div class="popBox-back"></div>
			<div class="popBox-box">
				<div class="popBox-con">
					<div class="remove-con">
						<div class="tit">你确定要删除吗？</div>
						<div class="btns">
							<a href="javascript:;" class="btn w144">删 除</a> 
							<a href="javascript:;" class="btn-gray w144">取 消</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
			$(function(){
				init();
				quxiao();//
			});
		
			// 删除
			function init(){
				$('.remove').click(function() {
					var id = this.id;
					$('.remove-pop').show();
					$('.remove-pop .btn').click(function(){
						$.ajax({
							type : "post",
							url : "${path}/siteArticleComment/del.html",
							dataType : "json",
							data:{cid:id},
							async : false,
							success : function(data) {
								if(data.ajax_status == "ajax_status_success"){
									$('.popBox').hide();
									 $("#pageForm").submit();
								}else{
									alert(data.msg);
								}
								return false;
							},
							error : function(XMLHttpRequest, textStatus, errorThrown){
					          alert("出错了！");
					       }
						});
					});
				});
				
				$("a[name='passbtn']").click(function(){
					var id = this.id;
					$.ajax({
						type : "post",
						url : "${path}/siteArticleComment/pass.html",
						dataType : "json",
						data:{cid:id,isPass:1},
						async : false,
						success : function(data) {
							if(data.ajax_status == "ajax_status_success"){
								 $("#pageForm").submit();
							}else{
								alert(data.msg);
							}
							return false;
						},
						error : function(XMLHttpRequest, textStatus, errorThrown){
				          alert("出错了！");
				       }
					});
				});
				
				$("a[name='cannelbtn']").click(function(){
					var id = this.id;
					$.ajax({
						type : "post",
						url : "${path}/siteArticleComment/pass.html",
						dataType : "json",
						data:{cid:id,isPass:0},
						async : false,
						success : function(data) {
							if(data.ajax_status == "ajax_status_success"){
								 $("#pageForm").submit();
							}else{
								alert(data.msg);
							}
							return false;
						},
						error : function(XMLHttpRequest, textStatus, errorThrown){
				          alert("出错了！");
				       }
					});
				});
			}
			// 弹出框
			function quxiao(){
				var $btn = $('.popBox').find('.btn-gray');
				$btn.click(function() {
					$('.popBox').hide();
				});
			} 
			
	</script>
</body>
</html>